import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from pylab import mpl
mpl.rcParams['axes.unicode_minus'] = False
mpl.rcParams['font.sans-serif']=['SimHei']

import seaborn as sns
import tushare as ts

import index_jj as ijj
"""
蒙特卡洛模拟分析
是一种统计学方法 用于模拟数据的演变趋势
该模拟分析 每次输入都是随机选择输入值  通过大量的模拟 最终得出一个累计概率的分布图
"""
stocks = {'北汽蓝谷':'SHSE.600733','zjhl':'SHSE.600986'}
df = ijj.get_his_data(stocks['zjhl'],'2010-01-01', '2023-11-11')
df.index = pd.to_datetime(df.bob)
tech_rets = df.close.pct_change()[1:]
rets = tech_rets.dropna()
print(rets.quantile(0.05))